<?php
namespace APP\C;

class Index extends Controller
{
	protected $_perPage = 20;
	protected $_pageRange = 10;

	public function indexAction()
	{
		// 参数
		$page = $this->request->getParam('page', 1);

		// 数据
		$sql = 'SELECT SQL_CALC_FOUND_ROWS * FROM t_note';
		$data = $this->getDb()->fetchAll($sql);
		$sql = 'SELECT FOUND_ROWS()';
		$count = $this->getDb()->fetchOne($sql);
        $count = 100;

		
		// 分页
		$p = new \SF\Paginator($page, $count, $this->_perPage, $this->_pageRange);

		// 模板
		$this->view->page = $p->getRender();
		$this->view->data = $data;
		$this->view->render('note.tpl');
	}
}